# Contributor: Roberto Oliveira <robertoguimaraes8@gmail.com>
# Maintainer: Roberto Oliveira <robertoguimaraes8@gmail.com>
pkgname=gradle
pkgver=6.5.1
pkgrel=0
pkgdesc="Build tool with a focus on build automation and support for multi-language development"
url="https://gradle.org/"
arch="noarch !mips !mips64"
options="!check"
license="Apache-2.0"
depends="openjdk8"
source="https://services.gradle.org/distributions/gradle-$pkgver-bin.zip"

package() {
	local gradlehome="/usr/share/java/$pkgname"
	local destdir="$pkgdir/$gradlehome"

	install -dm755 "$destdir"/bin
	rm bin/*.bat
	install -m755 bin/* "$destdir"/bin

	install -dm755 "$pkgdir"/usr/bin
	ln -sf $gradlehome/bin/gradle "$pkgdir"/usr/bin/gradle

	install -dm755 "$destdir"/lib
	install -m644 lib/*.jar "$destdir"/lib

	install -dm755 "$destdir"/lib/plugins
	install -m644 lib/plugins/*.jar "$destdir"/lib/plugins

	# NOTICE file should be redistributed for derivative works
	local file; for file in LICENSE NOTICE; do
		install -m644 -D $file "$pkgdir"/usr/share/licenses/$pkgname/$file
	done
}

sha512sums="e1ae0b07a1de6646bff846012ea664965a8aa3204d658dd4bebba05dc3e1f79b1a0a6615d2fb899fc048460056e123287f4b882db454b3fb11aa6eb1a864ea87  gradle-6.5.1-bin.zip"
